package com.heima.search.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.search.dtos.HistorySearchDto;
import com.heima.search.service.ApUserSearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: ApUserSearchController
 * Description:
 * date: 2023/8/19 0019 16:59
 *
 * @author zHan
 */
@RestController
@Slf4j
@RequestMapping("/api/v1/history")
@Api(tags = "用户历史记录相关接口")
public class ApUserSearchController {

    @Autowired
    private ApUserSearchService apUserSearchService;

    /**
     * 加载用户历史记录
     * @return
     */
    @PostMapping("/load")
    @ApiOperation("加载用户历史记录")
    public ResponseResult load() {
        return apUserSearchService.loadSearch();
    }

    /**
     * 删除用户历史记录
     * @return
     */
    @PostMapping("/del")
    @ApiOperation("删除用户历史记录")
    public ResponseResult del(@RequestBody HistorySearchDto dto) {
        return apUserSearchService.deleteSearch(dto);
    }
}
